package com.kuaimacode.kframework.admin.services.address;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kuaimacode.kframework.common.Constant;
import com.kuaimacode.kframework.mybatis.mapper.user.AddressMapper;
import com.kuaimacode.kframework.mybatis.models.user.Address;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @author anzy
 * @date 2019/03/29
 */
@Service
public class  AddressService extends ServiceImpl<AddressMapper, Address> {

    	/**
    	 *  分页查找所有的数据
    	 * @param pageNum 当前页码，从1开始
    	 * @param pageSize  一页显示多少行
    	 * @return
    	 */
    	public PageInfo<Address> findAll(int pageNum, int pageSize,Address address) {
    		PageHelper.startPage(pageNum, pageSize);

    		List<Address> datas = baseMapper.queryAddressList(address);
    		return new PageInfo<Address>(datas);
    	}

    	public Address getAddressById(String id){

    		return baseMapper.getAddressById(id);
		}

}

